package com.example.cashier

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.cashier.databinding.ActivityCodeXiangBinding
import com.example.cashier.entity.CashierEntityItem
import com.example.common.view.view.BaseMvvmActivity
import dagger.hilt.android.AndroidEntryPoint
import java.text.SimpleDateFormat
import kotlin.random.Random

@AndroidEntryPoint
@Route(path = "/cashier/CodeXiangActivity")
class CodeXiangActivity : BaseMvvmActivity<ActivityCodeXiangBinding>() {
    override fun getLayoutId(): Int =R.layout.activity_code_xiang
    @Autowired
    lateinit var payer2: CashierEntityItem
    override fun initView() {
        super.initView()
        ARouter.getInstance().inject(this)
        val year1 = SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis())
        val year2 = SimpleDateFormat("2026-MM-dd").format(System.currentTimeMillis())
        var week = "${year1}至${year2}"
        var random = Random.nextInt(8999999)+9000000
        mDataBinding.tvNumber.text = "交易流水号: ${random}"
        mDataBinding.tvAddress.text = "天津八维培训学校"
        mDataBinding.tvMoney.text = week
        mDataBinding.tvOne.text = "￥${payer2.chargeAmount}"
        mDataBinding.tvCount.text = "${1}"
        mDataBinding.tvReceivableAmount.text = "￥${payer2.discountAmount}"
        mDataBinding.tvPenalty.text = "￥${payer2.penalty}"
        mDataBinding.tvChargeAmount.text = "￥${payer2.chargeAmount}"
        mDataBinding.tvBalanceDeduction.text = "￥${payer2.balanceDeduction}"
        mDataBinding.tvActualAmount.text = "￥${payer2.actualAmount}"
        mDataBinding.tvZfb.text = payer2.paymentMethod
        mDataBinding.tvPayerTime.text = SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis())
        mDataBinding.tvOperator.text = payer2.operator
    }

}